﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DaZhong.Model;

namespace DaZhong.app_code
{
    public  class DataListConver<T> where T : new()
    {
        /// <summary>
        /// List累加
        /// </summary>
        /// <param name="list"></param>
        /// <param name="incList"></param>
        /// <returns></returns>
       public static List<T> AddList(List<T> list, List<T> incList)
       {
           foreach (var item in incList)
           {
               list.Add(item);
           }
           return list;
       }
        /// <summary>
       /// 去重复数据数据-id为准
        /// </summary>
        /// <param name="list"></param>
        /// <param name="lastList"></param>
        /// <returns></returns>
       public static List<ids> RemoveItems(List<ids> list, List<ids> lastList)
       {
           bool notIn = true;
           List<ids> idsList = new List<ids>();
           {
               foreach (var items in list)
               {
                   foreach (var lastItems in lastList)
                   {
                       if (items.id.Equals(lastItems.id))
                       {
                           notIn = false;
                           break;
                       }
                   }
                   if (notIn)
                   {
                       idsList.Add(items); 
                   }
                   notIn = true;
               }
           }
           return idsList;
       }
    }
}
